/*
 * PerlinSampler.h
 *
 *  Created on: Oct 5, 2012
 *      Author: burek
 */

#ifndef PERLINSAMPLER_H_
#define PERLINSAMPLER_H_

#include "integers.h"
#include "math/Vec2D.h"

struct PerlinSampler
{
private:
	float internalSample(Uint32 x, Uint32 y) const;
	inline Vec2D getVector(Uint32 x, Uint32 y) const;
	inline float getValue(Uint32 x, Uint32 y, float dx, float dy) const;
	Uint32 maxLevels;
	Uint32 startShift;
	Uint32 iStartDiv;

	float startDiv;

	Vec2D vectorField[256];

public:
	float persistence;
	Uint32 startSeed;
	Uint32 wrapAround;

	PerlinSampler(float Persistence, int MaxLevels);
	~PerlinSampler();

	float sample(Uint32 x, Uint32 y, float dx, float dy) const;
	float multiSample(float x, float y) const;
};


#endif /* PERLINSAMPLER_H_ */
